package edu.mju.observer;

/**
 * @Author:wyp
 * @Date:2020/9/19 21:46
 */
public class TestObserver {
    public static void main(String[] args) {
        ProductList productList = ProductList.getInstance();

        TaoBaoObserver taoBaoObserver = new TaoBaoObserver();
        JingDongObserver jingDongObserver = new JingDongObserver();

        //向productList注册taobao和jingdong观察者
        productList.addObserver(taoBaoObserver);
        productList.addObserver(jingDongObserver);

        productList.addProduct("新增产品1");
        System.out.println("---------------------------------------------------");
        productList.addProduct("新增产品2");

    }
}
